package gmusic.ma.bo;

import gmusic.bo.ReleaseBean;
import gmusic.services.impl.GMusicServicesImpl;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

public class ReleaseMABean extends ReleaseBean {

	private List<TrackMABean> tracksMA = new ArrayList<TrackMABean>();

	public ReleaseMABean() {
	}

	public ReleaseMABean(int maid, long groupeId, String nom, int typeId,
			int annee) {
		setMaid(maid);
		setArtistMaId(groupeId);
		setNom(nom);
		setTypeId(typeId);
		setAnnee(annee);
	}

	public ReleaseMABean(ResultSet rs) throws SQLException {
		setMaid(rs.getLong("maid"));
		setNom(rs.getString("nom"));
		setArtistMaId(rs.getLong("groupe_maid"));
		setAnnee(rs.getInt("annee"));
		setTypeId(rs.getInt("type_id"));
		setURLCover(rs.getString("url_cover"));
	}

	public String toString() {
		return super.toString();
	}

	public List<TrackMABean> getTracksMA() {
		return tracksMA;
	}

	public void setTracksMA(List<TrackMABean> tracks) {
		this.tracksMA = tracks;
	}

	public void addTrack(TrackMABean mt) {
		tracksMA.add(mt);
	}

	public boolean existsInGM() throws SQLException {
		return GMusicServicesImpl.getInstance().releaseExists(maid);
	}
}
